import { isCodeMessage } from "../config"

/**
 * @author: 小佘佘🦀
 * @description: 发送申请加入团队
 * @param {number} userId
 * @param {number} teamId
 * */
export const apply = async (userId: number, teamId: number) => {

    const params = new URLSearchParams()
    params.append("userId", userId + "")
    params.append("teamId", teamId + "")

    const response = await fetch(`/api-backend/api/team/apply`, {
        method: "POST",
        headers: {
            "Content-Type": "application/x-www-form-urlencoded",
        },
        body: params.toString(),
        redirect: "manual"
    })

    return isCodeMessage(response)
}